package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

/*
  使用对象的输入流进行对象的反序列化
  反序列化：将一组字节换位字符串
 */
public class OISDemo {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
       FileInputStream file=new FileInputStream("student.obj");
       ObjectInputStream os=new ObjectInputStream(file);
        Object o = os.readObject();//把读取出来的数据给Object
        Student s=(Student) o;//把object对象传给Student类，并强转
        System.out.println(s);
        os.close();
    }
}
